package cn.rkylin.oms.resend.service.impl;

import cn.rkylin.core.service.ApolloService;
import cn.rkylin.oms.resend.dao.IAfterSaleResendDAO;
import cn.rkylin.oms.resend.domain.AfterSaleResend;
import cn.rkylin.oms.resend.service.IAfterSaleResendService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 类名:AfterSaleResendServiceImpl <br/>
 * 作用: 补发单服务层实现. <br/>
 * 创建原因: 对补发单提供对外实现. <br/>
 * 创建时间: 2017年11月7日 下午2:20:00 <br/>
 *
 * @author liPeng
 * @version v1.0
 */
@Service("resendService")
public class AfterSaleResendServiceImpl extends ApolloService implements IAfterSaleResendService {

    private static final Log logger = LogFactory.getLog(AfterSaleResendServiceImpl.class);

    /**
     * resendDAO:补发单数据访问层.
     */
    @Autowired
    public IAfterSaleResendDAO resendDAO;

    /**
     * 修改补发单
     *
     * @param record 补发单bean
     * @return 修改补发单条数
     * @throws Exception 异常
     */
    public int updateResend(AfterSaleResend record) throws Exception {
        return resendDAO.updateByPrimaryKeySelective(record);
    }

    /**
     * 通过来源ID获取系统补发单
     *
     * @param sourceId
     * @return
     * @throws Exception
     */
    @Override
    public List<AfterSaleResend> selectResendForSysOrder(String sourceId) throws Exception {
        return resendDAO.selectResendForSysOrder(sourceId);
    }
}
